package cn.merryyou.jpa.domain;


import cn.merryyou.jpa.domain.primarykey.UserPackagePK;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;

@Entity
@Setter
@Getter
@Table(name = "user_package")
@IdClass(value = UserPackagePK.class)
@NoArgsConstructor
public class UserPackage implements Serializable {
    private static final long serialVersionUID = -6625686421365869422L;

    @Id
    @ManyToOne
    @JoinColumn(name = "user_id", unique = true)
    private User user;

    @Id
    @ManyToOne
    @JoinColumn(name = "package_id", unique = true)
    private RedPackage redPackage;

    @Column(name = "receive_time")
    private Date receiveTime;

}
